package com.bupt.liutong.admin.shop.dao;

import java.util.List;

import com.bupt.liutong.admin.core.base.Ibatis;
import com.bupt.liutong.admin.shop.dto.Cart;

public class CartDao {
	
	private Ibatis ibatis;
	
	// 添加商品到购物车
	public void insertCart(Cart cart) {
		ibatis.insert("shop_cart.insertCart", cart);
	}
	
	// 查看购物车
	@SuppressWarnings("unchecked")
	public List<Cart> getCarts(Cart cart) {
		return (List<Cart>) ibatis.queryForList("shop_cart.getCarts", cart);
	}
	
	public Cart getCartByProdId(Cart cart) {
		return (Cart) ibatis.queryForObject("shop_cart.getCartByProdId", cart);
	}
	
	public void updateCart(Cart cart) {
		ibatis.update("shop_cart.updateCart", cart);
	}

	public void setIbatis(Ibatis ibatis) {
		this.ibatis = ibatis;
	}
}
